package com.acwing.partition44;

import java.io.*;
import java.util.HashMap;
import java.util.Map;

/**
 * @author `RKC`
 * @date 2022/3/20 19:03
 */
public class AC4376数圈圈 {

    private static Map<Integer, Integer> map = new HashMap<>();

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        map.put(0, 1);
        map.put(4, 1);
        map.put(6, 1);
        map.put(9, 1);
        map.put((int) 'a', 1);
        map.put((int) 'd', 1);
        map.put(8, 2);
        map.put((int) 'b', 2);
        map.put(1, 0);
        map.put(2, 0);
        map.put(3, 0);
        map.put(5, 0);
        map.put(7, 0);
        map.put((int) 'c', 0);
        map.put((int) 'e', 0);
        map.put((int) 'f', 0);
        int n = Integer.parseInt(reader.readLine()), ans = 0;
        String s = Integer.toHexString(n);
        for (int i = 0; i < s.length(); i++) {
            int cnt = 0;
            if (Character.isDigit(s.charAt(i))) {
                cnt = map.get(s.charAt(i) - '0');
            } else {
                cnt = map.get((int) s.charAt(i));
            }
            ans += cnt;
        }
        writer.write(ans + "\n");
        writer.flush();
    }
}
